package com.zzl.java8.czbk.stream.test2;

import java.util.Objects;

/**
 * description: 课程类
 * @author 朱正磊
 * @date 2022-07-01 23:37:22
 */
public class PbCourses implements Comparable<PbCourses> {

    private Long id;

    private String courseName;

    private Integer price;

    public PbCourses() {

    }

    public PbCourses(Long id, String courseName, Integer price) {
        this.id = id;
        this.courseName = courseName;
        this.price = price;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        PbCourses pbCourses = (PbCourses) o;
        return id.equals(pbCourses.id) && courseName.equals(pbCourses.courseName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, courseName);
    }

    @Override
    public String toString() {
        return "PbCourses{" +
                "id=" + id +
                ", courseName='" + courseName + '\'' +
                ", price=" + price +
                '}';
    }

    @Override
    public int compareTo(PbCourses o) {
        return this.price - o.price;
    }

}
